import { decode } from '@/utils/utils'

export default {
  created() {
    window.addEventListener('popstate', this.routerBack, false)
  },
  destroyed() {
    window.removeEventListener('popstate', this.routerBack, false)
  },
  methods: {
    routerBack() {
      const redirect = decode(this.$route.query.redirect)
      this.$router.push(redirect)
    },
  },
}
